#!/bin/bash
cat list.txt | while read line
do
    ip=`echo $line|awk '{print $1}'`
    user=`echo $line | awk '{print $2}'`
    password=`echo $line | awk '{print $3}'`
    
    # 自动登录并检测，当LC_ALL的值为C时，记录下来
    /usr/bin/expect <<-EOF
    spawn ssh ${user}@${ip}
    expect {
            "yes/no" { send "yes\r" }
            "password:" { send "\${password}\r" }
    }
    expect eof
EOF
done
